<?php

namespace app\service\article;

use app\service\base\BaseModel;
use think\facade\Db;

class ArticleCategoryModel extends BaseModel
{
    protected $name = 'article_category';

    public function add($arrData)
    {
        return Db::name($this->name)->insertGetId($arrData);
    }

    public function delByArticleId($articleId)
    {
        return Db::name($this->name)
            ->where('article_id', $articleId)
            ->delete();
    }

    public function getList($arrWhere, $field = 'id')
    {
        return Db::name($this->name)->field($field)->where($arrWhere)->select()->toArray();
    }
}